# Contributor: Sascha Paunovic <azarus@posteo.net>
# Maintainer: Sascha Paunovic <azarus@posteo.net>
pkgname=simh
pkgver=3.11.1
_pkgver=3.11-1
pkgrel=1
pkgdesc="simulator for historical computers"
url="http://simh.trailing-edge.com"
arch="all"
license="BSD-3-Clause"
options="!check"
makedepends="libpcap-dev"
source="simh-$pkgver.tar.gz::https://github.com/simh/simh/archive/v$_pkgver.tar.gz
	gcc-10.patch"
builddir="$srcdir"/simh-$_pkgver

export CFLAGS="$CFLAGS -fcommon"

build() {
	mkdir BIN
	find VAX -type f -exec sed -i 's/SIM_INLINE//' {} +
	make USEN_NETWORK=1 NETWORK_OPT="-DUSE_NETWORK -isystem /usr/include -lpcap"
}

package() {
	cd "$builddir"/BIN
	for i in *; do
		install -D $i "$pkgdir"/usr/bin/simh-$i
	done

	cd "$builddir"/VAX
	mkdir -p "$pkgdir"/usr/lib/simh
	cp *.bin "$pkgdir"/usr/lib/simh
}

sha512sums="
7c2f81a64d3016b9a44409fc336c804c0da836317745d47594cc48c64cb57dc8f22084d9086e3f86868ec485ee56ac63301f350cee6d275e705b7c5fc82875db  simh-3.11.1.tar.gz
9b6ac5106528e9cd403cfc0a9b0d22192bed5ed1172bb34447274c69b3c2408e47f08125fc845b82091f55e21adf67c72db531d9032f413aaad06b3f55655ca4  gcc-10.patch
"
